package com.li.controller;

import jdk.nashorn.internal.runtime.logging.Logger;
import org.apache.tomcat.util.http.parser.Host;
import org.springframework.http.HttpRequest;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;

/**
 * @author lirenchun
 */
@RestController
@RequestMapping("/kafka")
public class KafkaController {
    @Resource
    private KafkaTemplate<String, String> kafkaTemplate;

    @RequestMapping("/send")
    public String sendMessage(String message, HttpServletRequest httpServletRequest) {
        System.out.println(httpServletRequest.getLocalPort());
       return httpServletRequest.getLocalPort()+"/"+httpServletRequest.getRequestURI();


       /* kafkaTemplate.send("demo", message);*/
       /* return "发送:"+message+"完成!";*/
    }

}
